<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>

</html>
<style>
    body {
        perspective: 800px;
        background-color: black;
    }
    
    .outer {
        position: relative;
        width: 200px;
        height: 200px;
        margin: 200px auto;
        transform-style: preserve-3d;
        animation: myanimation 8s linear infinite;
    }
    
    .outer>div:nth-child(-n+12) {
        position: absolute;
        opacity: 0.5;
        width: 200px;
        height: 200px;
        background-repeat: no-repeat;
        background-size: 100% 100%;
        border-radius: 12px;
        transition: all .5s;
    }
    
    .outer>div:nth-child(1),
    .outer>div:nth-child(7) {
        background-image: url(/img/1.jpg);
        transform: rotateX(90deg) translateZ(100px);
    }
    
    .outer>div:nth-child(2),
    .outer>div:nth-child(8) {
        background-image: url(/img/2.jpg);
        transform: rotateY(-90deg) translateZ(100px);
    }
    
    .outer>div:nth-child(3),
    .outer>div:nth-child(9) {
        background-image: url(/img/3.jpg);
        transform: rotateY(90deg) translateZ(100px);
    }
    
    .outer>div:nth-child(4),
    .outer>div:nth-child(10) {
        background-image: url(/img/4.jpg);
        transform: rotateX(-90deg) translateZ(100px);
    }
    
    .outer>div:nth-child(5),
    .outer>div:nth-child(11) {
        background-image: url(/img/5.jpg);
        transform: rotateX(180deg) translateZ(100px);
    }
    
    .outer>div:nth-child(6),
    .outer>div:nth-child(12) {
        background-image: url(/img/6.jpg);
        transform: rotateX(0deg) translateZ(100px);
    }
    /* .outer:hover>div:nth-child(7) {
        opacity: 1;
        transform: rotateX(450deg) translateZ(150px);
    } */
    
    .outer:hover>div:nth-child(8) {
        opacity: 1;
        transform: rotateY(-450deg) translateZ(150px);
        animation: myanimation3 5s linear infinite;
    }
    
    .outer:hover>div:nth-child(9) {
        opacity: 1;
        transform: rotateY(450deg) translateZ(150px);
        animation: myanimation3 5s linear infinite;
    }
    /* .outer:hover>div:nth-child(10) {
        opacity: 1;
        transform: rotateX(-450deg) translateZ(150px);
    } */
    
    .outer:hover>div:nth-child(11) {
        opacity: 1;
        transform: rotateX(540deg) translateZ(150px);
        animation: myanimation3 5s linear infinite;
    }
    
    .outer:hover>div:nth-child(12) {
        opacity: 1;
        transform: rotateX(360deg) translateZ(150px);
        animation: myanimation3 5s linear infinite;
    }
    
    .inner {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translateX(-50%) translateY(-50%);
        width: 100px;
        height: 100px;
        transform-style: preserve-3d;
        animation: myanimation2 1s linear infinite;
    }
    
    .inner>div {
        position: absolute;
        width: 100px;
        height: 100px;
        background-repeat: no-repeat;
        background-size: 100% 100%;
        opacity: 1;
        border-radius: 12px;
    }
    
    .inner>div:nth-child(1) {
        background-image: url(/img/1.jpg);
        transform: rotateX(90deg) translateZ(50px);
    }
    
    .inner>div:nth-child(2) {
        background-image: url(/img/2.jpg);
        transform: rotateY(-90deg) translateZ(50px);
    }
    
    .inner>div:nth-child(3) {
        background-image: url(/img/3.jpg);
        transform: rotateY(90deg) translateZ(50px);
    }
    
    .inner>div:nth-child(4) {
        background-image: url(/img/4.jpg);
        transform: rotateX(-90deg) translateZ(50px);
    }
    
    .inner>div:nth-child(5) {
        background-image: url(/img/5.jpg);
        transform: rotateX(180deg) translateZ(50px);
    }
    
    .inner>div:nth-child(6) {
        background-image: url(/img/6.jpg);
        transform: rotateX(0deg) translateZ(50px);
    }
    
    @keyframes myanimation {
        0% {
            transform: rotateX(0deg) rotateY(0deg);
        }
        100% {
            transform: rotateX(360deg) rotateY(720deg);
        }
    }
    
    @keyframes myanimation2 {
        0% {
            transform: translateX(-50%) translateY(-50%);
        }
        100% {
            transform: translateX(-50%) translateY(-50%);
        }
    }
    /* @keyframes myanimation3 {
        0% {
            transform: translateX(0) translateY(0);
        }
        100% {
            transform: translateX(360deg) translateY(360px);
        }
} */
</style>
</head>

<body>
    <div class="outer">
        <div class="box1"></div>
        <div class="box2"></div>
        <div class="box3"></div>
        <div class="box4"></div>
        <div class="box5"></div>
        <div class="box6"></div>

        <div class="box7"></div>
        <div class="box8"></div>
        <div class="box9"></div>
        <div class="box10"></div>
        <div class="box11"></div>
        <div class="box12"></div>


        <div class="inner">
            <div class="box1"></div>
            <div class="box2"></div>
            <div class="box3"></div>
            <div class="box4"></div>
            <div class="box5"></div>
            <div class="box6"></div>
        </div>
    </div>
</body>

</html>